Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync-with-eclipse-ecal-2024-08-02 #77

Merged
merged 5 commits into from
Aug 2, 2024

Conversation

rex-schilasky
Copy link
Contributor

sync-with-eclipse-ecal-2024-08-02

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

};
}

namespace Startup
{
struct Configuration
{
std::string terminal_emulator; //!<
std::string terminal_emulator { "" }; //!< Linux only command for starting applications with an external terminal emulator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: redundant string initialization [readability-redundant-string-init]

Suggested change
std::string terminal_emulator { "" }; //!< Linux only command for starting applications with an external terminal emulator
std::string terminal_emulator; //!< Linux only command for starting applications with an external terminal emulator

namespace
{
// After switchting to c++17, this can be replaced by an inline constexpr
static const eCAL_Logging_Filter log_level_default = log_level_info | log_level_warning | log_level_error | log_level_fatal;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'log_level_default' defined in a header file; variable definitions in header files can lead to ODR violations [misc-definitions-in-headers]

  static const eCAL_Logging_Filter log_level_default = log_level_info | log_level_warning | log_level_error | log_level_fatal;
                                   ^

namespace
{
// After switchting to c++17, this can be replaced by an inline constexpr
static const eCAL_Logging_Filter log_level_default = log_level_info | log_level_warning | log_level_error | log_level_fatal;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'log_level_default' is a static definition in anonymous namespace; static is redundant here [readability-static-definition-in-anonymous-namespace]

Suggested change
static const eCAL_Logging_Filter log_level_default = log_level_info | log_level_warning | log_level_error | log_level_fatal;
const eCAL_Logging_Filter log_level_default = log_level_info | log_level_warning | log_level_error | log_level_fatal;

struct Configuration
{
bool enable { false }; //!< Enable file logging (Default: false)
std::string path { "" }; //!< Path to log file (Default: "")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: redundant string initialization [readability-redundant-string-init]

Suggested change
std::string path { "" }; //!< Path to log file (Default: "")
std::string path; //!< Path to log file (Default: "")

std::string filter_incl{}; //!< Topics whitelist as regular expression (will be monitored only) (Default: "")
eCAL::Types::ConstrainedInteger<1000, 1000> timeout { 5000U }; //!< Timeout for topic monitoring in ms (Default: 5000)
std::string filter_excl { "^__.*$" }; //!< Topics blacklist as regular expression (will not be monitored) (Default: "^__.*$")
std::string filter_incl { "" }; //!< Topics whitelist as regular expression (will be monitored only) (Default: "")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: redundant string initialization [readability-redundant-string-init]

Suggested change
std::string filter_incl { "" }; //!< Topics whitelist as regular expression (will be monitored only) (Default: "")
std::string filter_incl; //!< Topics whitelist as regular expression (will be monitored only) (Default: "")

bool IpAddressV4::operator==(const eCAL::Types::IpAddressV4& rhs) const { return m_ip_address == rhs.Get(); };
bool operator==(eCAL::Types::IpAddressV4 lhs, const char* ip_string_) { return lhs.Get() == std::string(ip_string_); };
bool operator==(const char* ip_string_, eCAL::Types::IpAddressV4 rhs) { return rhs == ip_string_; };
bool operator==(eCAL::Types::IpAddressV4 lhs, const std::string& ip_string_) { return lhs.Get() == ip_string_; };
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: the parameter 'lhs' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]

Suggested change
bool operator==(eCAL::Types::IpAddressV4 lhs, const std::string& ip_string_) { return lhs.Get() == ip_string_; };
bool operator==(const eCAL::Types::IpAddressV4& lhs, const std::string& ip_string_) { return lhs.Get() == ip_string_; };

ecal/core/include/ecal/types/ecal_custom_data_types.h:58:

-       ECAL_API friend bool operator==(eCAL::Types::IpAddressV4 lhs, const std::string& ip_string_);
+       ECAL_API friend bool operator==(const eCAL::Types::IpAddressV4& lhs, const std::string& ip_string_);

bool operator==(eCAL::Types::IpAddressV4 lhs, const char* ip_string_) { return lhs.Get() == std::string(ip_string_); };
bool operator==(const char* ip_string_, eCAL::Types::IpAddressV4 rhs) { return rhs == ip_string_; };
bool operator==(eCAL::Types::IpAddressV4 lhs, const std::string& ip_string_) { return lhs.Get() == ip_string_; };
bool operator==(const std::string& ip_string_, eCAL::Types::IpAddressV4 rhs) { return rhs == ip_string_; };
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: parameter 'rhs' is passed by value and only copied once; consider moving it to avoid unnecessary copies [performance-unnecessary-value-param]

Suggested change
bool operator==(const std::string& ip_string_, eCAL::Types::IpAddressV4 rhs) { return rhs == ip_string_; };
bool operator==(const std::string& ip_string_, eCAL::Types::IpAddressV4 rhs) { return std::move(rhs) == ip_string_; };


// test copy method for config structure
eCAL::Configuration config1(0, nullptr);
eCAL::Configuration config2(0, nullptr);
std::string testValue = std::string("234.0.3.2");
config2.transport_layer.mc_options.group = testValue;
std::string testValue = "234.0.3.2";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'testValue' of type 'std::string' (aka 'basic_string') can be declared 'const' [misc-const-correctness]

Suggested change
std::string testValue = "234.0.3.2";
std::string const testValue = "234.0.3.2";


std::vector<std::string> arguments{};

arguments.push_back("test_config_cmd_parser_test");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use emplace_back instead of push_back [modernize-use-emplace]

Suggested change
arguments.push_back("test_config_cmd_parser_test");
arguments.emplace_back("test_config_cmd_parser_test");

// set a file name as ini file
arguments.push_back("--ecal-config-file " + some_file_name);
// set the dump config flag
arguments.push_back("--ecal-dump-config");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: use emplace_back instead of push_back [modernize-use-emplace]

Suggested change
arguments.push_back("--ecal-dump-config");
arguments.emplace_back("--ecal-dump-config");

@rex-schilasky rex-schilasky merged commit 15cd47f into main Aug 2, 2024
82 checks passed
@rex-schilasky rex-schilasky deleted the sync-with-eclipse-ecal-2024-08-02 branch August 2, 2024 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant